if(!window.js2se)window.js2se=window.java={};

java.util={};

java.util.Arrays=(function(){
	var ap=Array.prototype;
	ap.contains=function(e){return this.indexOf(e)!=-1};
	ap.insertAt=function(e,i){this.splice(i,0,e)};
	ap.insertBefore=function(n,e){var i=this.indexOf(e);if(i==-1)this.push(n);else this.splice(i,0,n)};
	ap.removeAt=function(i){this.splice(i,1)};
	ap.indexOf=function(e){for(var i=0;i<this.length;i++)if(this[i]==e)return i;return -1};
	ap.lastIndexOf=function(e){for(var i=this.length-1;i>=0;i--)if(this[i]==e)return i;return -1};
	ap.copy=function(){var i,c=[];for(i=0;i<this.length;i++)c[i]=this[i];return c};
	ap.clone=function(){return Array.apply(null,this)};
	return {}
})();
java.util.Arrays.sort=function(a){if(a instanceof Array||a.sort)a.sort()};
java.util.Arrays.equals=function(a,b){if(a==b)return true;if(a==null||b==null)return false;if(a.length!=b.length)return false;for(var i=0;i<a.length;i++)if(a[i]!=b[i])return false;return true};
java.util.Arrays.fill=function(a){var A,i,v,s=0,e=a.length;A=arguments;v=A[1];if(A.length==4){s=A[1];e=A[2];v=A[3]}for(i=s;i<e;i++)a[i]=v};
java.util.Arrays.asList=function(a){return new java.util.ArrayList(a)};
java.util.Arrays.toString=function(a){return a?a.toString():"[]"};

java.util.AbstractCollection=function(){
	Array.apply(this,arguments);
	this.clear=function(){this.length=0};
	this.isEmpty=function(){return this.size()==0};
	this.remove=function(e){var i=this.indexOf(e);if(i!=-1)this.splice(i,1)};
	this.removeAll=function(c){for(var i=0;i<c.length;i++)if(this.contains(c[i]))this.remove(c[i])};
	this.size=function(){return this.length};
	this.toArray=function(){return new Array(this)};
	this.toString=function(){return "["+this.join(",")+"]"};
	for(var i=0;i<arguments.length;)this.push(arguments[i++]);
};
java.util.AbstractCollection.prototype=new Array();

java.util.AbstractList=function(){
	java.util.AbstractCollection.apply(this,arguments);
	this.iterator=function(){return new java.util.Iterator(this)};
};
java.util.AbstractList.prototype=new java.util.AbstractCollection();

java.util.ArrayList=function(){
	java.util.AbstractList.apply(this,arguments);
	this.add=function(e){return this.push(e)};
	this.clone=function(){return this.copy()};
	this.get=function(i){return this[i]};
	this.set=function(i,e){this.insertAt(e,i)};
};
java.util.ArrayList.prototype=new java.util.AbstractList();

java.util.Date=(function(){
	var dp=Date.prototype;
	dp.equals=function(o){return (this.getTime()==o.getTime())};
	dp.compareTo=function(o){if(o&&o.getTime){var t2,t1=this.getTime();t2=o.getTime();return(t1<t2)?-1:(t1==t2)?0:1;}else if(window.ClassCastException)throw new ClassCastException("java.util.Date.compareTo(): The argument is not a Date.")};
})();

java.util.HashMap=function(){
	var hash={};
	var length=0;
	this.get=function(k){return hash[k]};
	this.keySet=function(){var i,k=[];for(i in hash)if(typeof hash[i]!="function")k.push(i);return k};
	this.put=function(k,v){hash[k]=v;length++};
	this.containsKey=function(k){var r=String(this.get(k));return(r!='undefined'&&r!='null')};
	this.containsValue=function(v){for(var i in hash)if(hash[i]==v)return true;return false};
	this.isEmpty=function(){return length==0};
	this.clear=function(){hash={};length=0};
	this.size=function(){return length};
	this.remove=function(k){if(this.containsKey(k))length--;hash[k]=null};
};

java.util.Hashtable=function(){
	java.util.HashMap.apply(this,arguments);
	this.contains=function(v){return this.containsValue(v)};
};

java.util.Iterator=function(){
	var list=arguments[0];
	var index=0;
	this.hasNext=function(){return index<list.length};
	this.next=function(){return e=list[index++]};
	this.remove=function(){var e=list[index];if(e)list.remove(e)};
};

java.util.Properties=function(){
	java.util.Hashtable.apply(this,arguments);
	this.getProperty=function(k,d){return this.get(k)?this.get(k):((d)?d:null)};
	this.setProperty=function(k,v){this.put(k,v)};
	this.load=function(fileName){var s,r=(window.XMLHttpRequest)?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");r.open("GET",fileName,false);r.send(null);s=r.responseText;if(s)parse(s)};
	function parse(s){var k,i,p,l=String(s).split("\n");for(i=0;i<l.length;i++){if(l[i].indexOf("#")==0)continue;p=l[i].split("=");k=p[0];if(p.length>1)self.put(k,(l[i].substring((p[0]+"=").length)).replace(/(^\s+)|(\s+$)/g,""))}}
	var self=this;
};

java.util.ResourceBundle=function(locale){
	locale=locale||null;
	this.getLocale=function(){return locale};
	this.getString=function(key){var s=this.getObject(key);return s?String(s):null};
	this.getStringArray=function(key){var s=this.getString(key);return s?s.split(","):null};
	this.getObject=function(key){return this.__cache.getProperty(key)};
	this.__cache=new java.util.Properties();
};
java.util.ResourceBundle.getBundle=function(baseName,locale){if(!locale)locale=java.util.Locale.getDefault();var rb=new java.util.ResourceBundle(locale);rb.__cache.load((window.System&&System.getProperty?System.getProperty("java.class.path"):"")+baseName+"_"+locale+".properties");return rb};

java.util.Locale=function(language,country,variant){
	var ln=language,ct=country,vr=variant;
	this.getLanguage=function(){return ln};
	this.getCountry=function(){return ct};
	this.getVariant=function(){return vr};
	this.getDefault=java.util.Locale.getDefault;
	this.setDefault=java.util.Locale.setDefault;
	this.getInstance=java.util.Locale.getInstance;
	this.toString=function(){var a=[ln];if(ct||(ln&&vr))a.push(ct);if(vr&&(ln||ct))a.push(vr);return a.join("_")};
	this.equals=function(obj){if(!obj)return false;if(this==obj)return true;if(!(obj instanceof java.util.Locale))return false;return language==obj.language&& country==obj.country&&variant==obj.variant};
};
java.util.Locale.getDefault=function(){var dl=java.util.Locale.getDefault.__dl;if(!dl){if(window.System&&System.getProperty){var i,r,v,c=System.getProperty("user.country");v=System.getProperty("user.variant");r=System.getProperty("user.region");if(r){i=r.indexOf('_');if(i>=0){c=r.substring(0,i);v=r.substring(i+1)}}dl=new java.util.Locale(System.getProperty("user.language"),c,v)}else dl=java.util.Locale.ENGLISH}java.util.Locale.getDefault.__dl=dl;return dl};
java.util.Locale.setDefault=function(newLocale){if(newLocale==null)throw new NullPointerException("Can't set default locale to NULL");java.util.Locale.getDefault.__dl=newLocale};
java.util.Locale.getInstance=function(language,country,variant){if(!java.util.Locale.cache)java.util.Locale.cache=new java.util.HashMap();if(language==null||country==null||variant==null)throw new NullPointerException();var l,k=[language,country,variant].join("_");l=java.util.Locale.cache.get(k);if(!l){l=new java.util.Locale(language,country,variant);java.util.Locale.cache.put(k,l)}return l};
java.util.Locale.getAvailableLocales=function(){return [java.util.Locale.ENGLISH]};

java.util.Locale.ENGLISH=new java.util.Locale("en");
java.util.Locale.RUSSIAN=new java.util.Locale("ru");
java.util.Locale.UKRAINIAN=new java.util.Locale("uk");
java.util.Locale.DUTCH=new java.util.Locale("nl");

java.util.Locale.UK=new java.util.Locale("en","GB");
java.util.Locale.US=new java.util.Locale("en","US");
java.util.Locale.CANADA=new java.util.Locale("en","CA");

